package p046bf;

import java.util.Arrays;
import p114do.Buffer;
import p270jp.pxv.android.commonObjects.model.ApplicationConfig;
import p270jp.pxv.android.legacy.model.DeviceInfo;
import p325m0.MutabilityOwnership;

/* renamed from: bf.e */
/* loaded from: classes2.dex */
public final class PixivAppUserAgents {

    /* renamed from: a */
    public final String f5004a;

    /* renamed from: b */
    public final String f5005b;

    public PixivAppUserAgents(ApplicationConfig applicationConfig, DeviceInfo deviceInfo) {
        MutabilityOwnership.m3745m(applicationConfig, "applicationConfig");
        MutabilityOwnership.m3745m(deviceInfo, "deviceInfo");
        Object[] objArr = new Object[3];
        objArr[0] = applicationConfig.getVersionName();
        objArr[1] = deviceInfo.getReleaseVersion();
        String modelName = deviceInfo.getModelName();
        MutabilityOwnership.m3745m(modelName, "s");
        int length = modelName.length();
        int i = 0;
        while (i < length) {
            int codePointAt = modelName.codePointAt(i);
            if (codePointAt <= 31 || codePointAt >= 127) {
                Buffer dVar = new Buffer();
                dVar.m7199p0(modelName, 0, i);
                while (i < length) {
                    int codePointAt2 = modelName.codePointAt(i);
                    dVar.m7198s0((codePointAt2 <= 31 || codePointAt2 >= 127) ? 63 : codePointAt2);
                    i += Character.charCount(codePointAt2);
                }
                modelName = dVar.m7220I();
                objArr[2] = modelName;
                String format = String.format("PixivAndroidApp/%s (Android %s; %s)", Arrays.copyOf(objArr, 3));
                MutabilityOwnership.m3746l(format, "java.lang.String.format(format, *args)");
                this.f5004a = format;
                String format2 = String.format("PixivAndroidApp/%s", Arrays.copyOf(new Object[]{applicationConfig.getVersionName()}, 1));
                MutabilityOwnership.m3746l(format2, "java.lang.String.format(format, *args)");
                this.f5005b = format2;
            }
            i += Character.charCount(codePointAt);
        }
        objArr[2] = modelName;
        String format3 = String.format("PixivAndroidApp/%s (Android %s; %s)", Arrays.copyOf(objArr, 3));
        MutabilityOwnership.m3746l(format3, "java.lang.String.format(format, *args)");
        this.f5004a = format3;
        String format22 = String.format("PixivAndroidApp/%s", Arrays.copyOf(new Object[]{applicationConfig.getVersionName()}, 1));
        MutabilityOwnership.m3746l(format22, "java.lang.String.format(format, *args)");
        this.f5005b = format22;
    }
}
